package com.grass.p019lv.activity;

import android.graphics.Color;
import android.graphics.Typeface;
import android.view.View;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.androidsa.bttsddka.R;
import com.androidx.p013lv.base.p015ui.BaseActivity;
import com.grass.p019lv.databinding.ActivitySearchResultBindingImpl;
import com.grass.p019lv.fragment.search.SearchPeopleFragment;
import com.grass.p019lv.fragment.search.SearchVideoFragment;
import com.gyf.immersionbar.ImmersionBar;

/* renamed from: com.grass.lv.activity.SearchResultActivity */
public class SearchResultActivity extends BaseActivity<ActivitySearchResultBindingImpl> implements View.OnClickListener {
    SearchPeopleFragment peopleFragment;
    public String searchTxt;
    SearchVideoFragment videoFragment;

    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public int setLayout() {
        return R.layout.activity_search_result;
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initView() {
        super.initView();
        ((ActivitySearchResultBindingImpl) this.binding).tvSearch.setText(this.searchTxt);
        ((ActivitySearchResultBindingImpl) this.binding).tvVideo.setOnClickListener(this);
        ((ActivitySearchResultBindingImpl) this.binding).tvPeople.setOnClickListener(this);
        ((ActivitySearchResultBindingImpl) this.binding).tvCancel.setOnClickListener(this);
        ((ActivitySearchResultBindingImpl) this.binding).tvSearch.setOnClickListener(this);
        ((ActivitySearchResultBindingImpl) this.binding).viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            /* class com.grass.p019lv.activity.SearchResultActivity.C28951 */

            @Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
            public void onPageScrollStateChanged(int i) {
            }

            @Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
            public void onPageScrolled(int i, float f, int i2) {
            }

            @Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
            public void onPageSelected(int i) {
                if (i == 0) {
                    SearchResultActivity searchResultActivity = SearchResultActivity.this;
                    searchResultActivity.onClick(((ActivitySearchResultBindingImpl) searchResultActivity.binding).tvVideo);
                    return;
                }
                SearchResultActivity searchResultActivity2 = SearchResultActivity.this;
                searchResultActivity2.onClick(((ActivitySearchResultBindingImpl) searchResultActivity2.binding).tvPeople);
            }
        });
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initData() {
        super.initData();
        this.videoFragment = SearchVideoFragment.newInstance(this.searchTxt);
        this.peopleFragment = SearchPeopleFragment.newInstance(this.searchTxt);
        ((ActivitySearchResultBindingImpl) this.binding).viewPager.setAdapter(new Adapter(getSupportFragmentManager(), 1));
    }

    public void onClick(View view) {
        if (view.getId() == R.id.tv_video) {
            ((ActivitySearchResultBindingImpl) this.binding).tvVideo.setTypeface(Typeface.DEFAULT_BOLD);
            ((ActivitySearchResultBindingImpl) this.binding).vVideo.setVisibility(0);
            ((ActivitySearchResultBindingImpl) this.binding).tvPeople.setTypeface(Typeface.DEFAULT);
            ((ActivitySearchResultBindingImpl) this.binding).tvVideo.setTextColor(-1);
            ((ActivitySearchResultBindingImpl) this.binding).tvPeople.setTextColor(Color.parseColor("#b1b1b1"));
            ((ActivitySearchResultBindingImpl) this.binding).vPeople.setVisibility(8);
            if (((ActivitySearchResultBindingImpl) this.binding).viewPager.getCurrentItem() != 0) {
                ((ActivitySearchResultBindingImpl) this.binding).viewPager.setCurrentItem(0);
            }
        } else if (view.getId() == R.id.tv_people) {
            ((ActivitySearchResultBindingImpl) this.binding).tvVideo.setTypeface(Typeface.DEFAULT);
            ((ActivitySearchResultBindingImpl) this.binding).vVideo.setVisibility(8);
            ((ActivitySearchResultBindingImpl) this.binding).tvPeople.setTypeface(Typeface.DEFAULT_BOLD);
            ((ActivitySearchResultBindingImpl) this.binding).vPeople.setVisibility(0);
            ((ActivitySearchResultBindingImpl) this.binding).tvPeople.setTextColor(-1);
            ((ActivitySearchResultBindingImpl) this.binding).tvVideo.setTextColor(Color.parseColor("#b1b1b1"));
            if (((ActivitySearchResultBindingImpl) this.binding).viewPager.getCurrentItem() != 1) {
                ((ActivitySearchResultBindingImpl) this.binding).viewPager.setCurrentItem(1);
            }
        } else if (view.getId() == R.id.tv_cancel) {
            finish();
        } else if (view.getId() == R.id.tv_search) {
            finish();
        }
    }

    /* renamed from: com.grass.lv.activity.SearchResultActivity$Adapter */
    class Adapter extends FragmentStatePagerAdapter {
        @Override // androidx.viewpager.widget.PagerAdapter
        public int getCount() {
            return 2;
        }

        private Adapter(FragmentManager fragmentManager, int i) {
            super(fragmentManager, i);
        }

        @Override // androidx.fragment.app.FragmentStatePagerAdapter
        public Fragment getItem(int i) {
            if (i == 0) {
                return SearchResultActivity.this.videoFragment;
            }
            return SearchResultActivity.this.peopleFragment;
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initImmersionBar() {
        super.initImmersionBar();
        ImmersionBar.with(this).titleBar(((ActivitySearchResultBindingImpl) this.binding).toolbar).init();
    }
}
